(:
  A procedure to build the "Rainbow categories" as a display file
:)
declare boundary-space strip;
import module namespace
    jj = "http://kumquat.emse.fr/utilitaires"
    at "jjutils.xq" ;
<display>{
let $t := $arguments[1]
let $d := doc($t)//cat
for $e at $p in $d
return
  <item>{
    <info name="type">rainbow category</info> ,
    <info name="src-anchor">{
      <anchor>{
        <doc>{ $t }</doc>,
        <path>{jj:build-Path($e)}</path>
      }</anchor>
    }</info>,
    <info name="name">{string($e/@cat)}</info>,
    <info name="rainbow-color"><bgcolor>{string($e/@color)}</bgcolor></info>,
    <info name="description">{$e/text()}</info>
  }</item>
}</display>
